import request from '@/utils/request'
// import qs from 'qs'

// 工程解析

// 上传文件
export function engineeringUpload (params) {
  var data = fromData(params)
  return request({
    url: '/engineering/upload',
    method: 'post',
    data
  })
}

// 开始解析
export function engineeringAnalysis (params) {
  var data = fromData(params)
  return request({
    url: '/engineering/analysis',
    method: 'post',
    data
  })
}

// 提交
export function engineeringUpdate (params) {
  var data = fromData(params)
  return request({
    url: '/engineering/update',
    method: 'post',
    data
  })
}

function fromData (params) {
  let formData = new FormData()
  for (const it in params) {
    if (!Object.is(params[it], null) && !Object.is(params[it], '')) {
      formData.append(it, params[it])
    }
  }
  return formData
}
